<?php
class Home extends MY_Controller{
    function __construct() {
        parent::__construct();
        $this->load->model('mintro');
		$this->load->model('model_region');
		$this->load->model('model_home');
		$this->load->library('pager');
    }
    function term() {
        $data['vietnam'] = $this->destination(1);
        $data['cambodia'] = $this->destination(2);
        $data['hlaos'] = $this->destination(3);
		$data['blogvie'] = $this->model_home->blog(1);
		$data['blogcam'] = $this->model_home->blog(2);
		$data['bloglao'] = $this->model_home->blog(3);
        $data['holiday'] = $this->holiday();
        $data['destination'] = $this->model_home->destination();
        $data['item'] = $this->mintro->getOne(2);
        $data['title'] = 'Booking & Conditions ';
        $data['template'] = 'home/content';
        $this->load->view('home/home/layout',$data);
    }
    function privacy() {
        $data['item'] = $this->mintro->getOne(3);
        $data['vietnam'] = $this->destination(1);
        $data['cambodia'] = $this->destination(2);
		$data['blogvie'] = $this->model_home->blog(1);
		$data['blogcam'] = $this->model_home->blog(2);
		$data['bloglao'] = $this->model_home->blog(3);
        $data['hlaos'] = $this->destination(3);
        $data['holiday'] = $this->holiday();
        $data['destination'] = $this->model_home->destination();
        $data['title'] = ' Privacy Policy';
        $data['template'] = 'home/content';
        $this->load->view('home/home/layout',$data);
    }
	public function attractions(){
		$id = $this->uri->segment(2);
		$data['vietnam'] = $this->destination(1);
        $data['cambodia'] = $this->destination(2);
		$data['hlaos'] = $this->destination(3);
		$data['blogvie'] = $this->model_home->blog(1);
		$data['blogcam'] = $this->model_home->blog(2);
		$data['bloglao'] = $this->model_home->blog(3);
		$data['dataid'] = $id;
		$start = 0;
        $limit = 8;
        $total = $this->model_region->count_region_d($id);
        $pages = $this->pager->page($total,$limit);
		$data['listpage'] = $this->pager->listpageregion($pages,$start,$limit,$id);
		$data['results'] = $this->model_region->attractions($id);
		//$this->debug($data['results']);
		if($data['results'] == NULL){
			redirect(base_url());
		}
		if($id == 1){ $title = "Vietnam top atrractions";}elseif($id == 2){
			$title = "Cabodia top atrractions";
		}else{$title = "Laos top atrractions";}
        $data['destination'] = $this->model_home->destination();
        $data['title'] = $title;
        $this->load->view('blogs/attractions/layout',$data);
	}
	public function links(){
        $data['vietnam'] = $this->destination(1);
        $data['cambodia'] = $this->destination(2);
		$data['blogvie'] = $this->model_home->blog(1);
		$data['blogcam'] = $this->model_home->blog(2);
		$data['bloglao'] = $this->model_home->blog(3);
        $data['hlaos'] = $this->destination(3);
        $data['holiday'] = $this->holiday();
        $data['destination'] = $this->model_home->destination();
        $data['title'] = 'Links exchange';
        $this->load->view('links/layout',$data);
	}
}
?>